package com.bw.car.adapter

import android.widget.TextView
import com.bw.car.R
import com.bw.car.entity.PackPayEntity
import com.bw.car.inter.Click
import com.bw.common.utils.MyTimeUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder

class PackPayAdapter:BaseQuickAdapter<PackPayEntity,BaseViewHolder>(R.layout.item_vehicle) {

    private var onclick: Click<PackPayEntity>?= null

    fun setItemClick(listener: Click<PackPayEntity>){
        this.onclick=listener
    }

    override fun convert(holder: BaseViewHolder, item: PackPayEntity) {
        holder.setText(R.id.vehicle_id,item.plateNumber)
        holder.setText(R.id.entryTime,"入场:${MyTimeUtils.allTimeToHour(item.entryTime)}")
        holder.setText(R.id.parkingDuration,"已停:${item.parkingDuration}分钟")
        holder.setText(R.id.parkingSpaceNumber,item.parkingSpaceNumber)
        holder.getView<TextView>(R.id.edit).setOnClickListener {
            onclick?.onCLick(item, position = 0)
        }
    }
}